<template>
  <el-breadcrumb separator="/">
    <el-breadcrumb-item :to="{ path: item.path }" v-for="item in breadArr" :key="item.path">{{
      item.meta.label
    }}</el-breadcrumb-item>
  </el-breadcrumb>
</template>

<script>
export default {
  name: '',
  data() {
    return {
      breadArr: [] // 面包屑导航数组
    }
  },
  created() {
    // console.log('当前路由信息对象', this.$route)
  },
  watch: {
    $route: {
      handler(newvalue) {
        // console.log('newvalue', newvalue)
        this.breadArr = newvalue.matched
      },
      immediate: true // 立即监听
    }
  }
}
</script>
<style lang='scss' scoped>
.el-breadcrumb {
  margin-bottom: 15px;
}
</style>